import {http} from "@/api/index";

const cinemaHall = {
    getCinemaHallList:'/cinemaHall/findAll',
    getCinemaHallListCondition:'/cinemaHall/findByCondition',
    addCinemaHall:'/cinemaHall/add',
    deleteCinemaHallById:'/cinemaHall/delete',
    logicDeleteCinemaHallById:'/cinemaHall/logicDelete',
    updateCinemaHall:'/cinemaHall/update',
}
const cinemaHallSeat = {
    getSeatListByHallId:'/cinemaHallSeat/findByHallId',
    generatorSeat:'/cinemaHallSeat/generate',
    updateSeat:'/cinemaHallSeat/update'
}
export const getCinemaHallList = ()=>{
    return http.request({
        url:cinemaHall.getCinemaHallList,
        method:'get',
    })
}
export const getCinemaHallListCondition = (params)=>{
    return http.request({
        url:cinemaHall.getCinemaHallListCondition,
        method:'get',
        params: params
    })
}

export const addCinemaHall = (params)=>{
    return http.request({
        url:cinemaHall.addCinemaHall,
        method:'post',
        data:params
    })
}

export const logicDeleteCinemaHallById = (cinemaHallId)=>{
    return http.request({
        url:cinemaHall.logicDeleteCinemaHallById,
        method:'get',
        params:{
            cinemaHallId:cinemaHallId
        }
    })
}
export const deleteCinemaHallById = (cinemaHallId)=>{
    return http.request({
        url:cinemaHall.deleteCinemaHallById,
        method:'get',
        params:{
            cinemaHallId:cinemaHallId
        }
    })
}
export const updateCinemaHall = (params)=>{
    return http.request({
        url:cinemaHall.updateCinemaHall,
        method:'post',
        data:params
    })
}

export const generatorSeat = (cinemaHallId,maxX,maxY)=>{
    return http.request({
        url:cinemaHallSeat.generatorSeat,
        method:'get',
        params:{
            cinemaHallId,
            maxX,
            maxY
        }
    })
}
export const getSeatByHallId = (cinemaHallId)=>{
    return http.request({
        url:cinemaHallSeat.getSeatListByHallId,
        method:'get',
        params:{
            cinemaHallId,
        }
    })
}
export const updateSeat = (params)=>{
    return http.request({
        url:cinemaHallSeat.updateSeat,
        method:'post',
        data:params
    })
}
